package cn.ex;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Ex2 {
    public static void main(String[] args) {
        String u = "http://www.beiyouedu.com/a/aboout/join/";
        try {
            Document doc = Jsoup.connect(u).get();
            System.out.println(Jsoup.connect("http://www.baidu.com").get().title());
            String str = doc.toString();

            //取出所有数字
            Pattern p1 = Pattern.compile("<img.*?>");
            Matcher m1 = p1.matcher(str);
            while(m1.find()) {

                System.out.printf("%s %n",m1.group());
            }

            Integer i = 30;
            int t = i.intValue();
            int t2 = i;

            //获取的手机号，邮箱地址
            Pattern p = Pattern.compile("\\d{11}|\\w+@[\\w,\\.]+");
            Matcher m = p.matcher(str);
            while (m.find()) {
                System.out.println(m.group());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
